import api from '@/views/ai/agent/utils/request/BaseRequest'
import { defineStore } from "pinia"
import cache from "@/utils/cache"
import store from '@/store'

export const webConfig = defineStore('webConfig', {
  state: () => ({
    resourceMain: {},
    resourcePromotionConfig: {},
    resourceAccountConfig: {}
  }),
  mutations: {
  },
  actions: {
    FlushWebConfigMain() {
      store.agentSettings.loadingStateConfig = true
      return new Promise((resolve) => {
        api.get('/module/system/baseresourceconfig/clientConfig').then(res => {
          this.$state.resourceMain = res.data.resourceMain
          this.$state.resourcePromotionConfig = res.data.resourcePromotionConfig
          this.$state.resourceAccountConfig = res.data.resourceAccountConfig

          resolve()
        })
      })
    }

  }
})
